options results /* indispensable pour récupérer le résultat des macros */
signal on error /* pour l'interception des erreurs */
signal on syntax
'SELECT("Component type to reference"+CHR(10)+"Resistances"+CHR(10)+"Capacitors"+CHR(10)+"Diodes"+CHR(10)+"Transistors"+CHR(10)+"Integrated circuits"+CHR(10)+"Specific Components")'
'ASK("What is the name of"+CHR(10)+"the components to reference?"+CHR(10)+"You can use the generic"+CHR(10)+"chars (#?) for a"+CHR(10)+"larger selection")'
type=result
if type='' then exit
'ASK("What is the reference"+CHR(10)+"for these components?")'
reference=result
if reference='' then exit
end
otherwise exit
end
'N=FIRSTSEL'; obj=result
if type=1 then do
if obj=0 then do
'MESSAGE("Mark the devices"+CHR(10)+"to reference, even the"+CHR(10)+"devices that are allready"+CHR(10)+"referenced before"+CHR(10)+"calling this script")'
exit
end
choix=1
end
else do
if obj>0 then do
'REQUEST("Do you want to reference"+CHR(10)+"only the selected"+CHR(10)+"components?"+CHR(10)+"If you choose NO the"+CHR(10)+"operation will be done"+CHR(10)+"for every component"+CHR(10)+"on the document.")'
choix=result
end
else choix=0
end
if choix=0 then do
/* Annulation du marquage éventuel */
'N=FIRSTSEL:WHILE(N>0,UNMARK(N),N=NEXTSEL(N))'
/* Marquage et comptage des éléments à référencer */